Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve flyte-core helm chart #5362

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

mvaalexp
Copy link

@mvaalexp mvaalexp commented May 14, 2024

Fixed flyte-core helm chart where ServiceAccounts were missing, incorrect typing, and some naming inconsistencies

Tracking issue

Closes #5361

Why are the changes needed?

Removes error messages in when running the chart

coalesce.go:286: warning: cannot overwrite table with non table for flyte-core.flyteagent.podEnv (map[])

Adds missing ServiceAccounts to services.

  • This default service account has limited permissions and is generally not recommended for use in production environments
    In our production clusters, we have governance that requires all Deployments must have an associated SA, this is currently preventing us from using the chart.

Adds the ability to override the service names.

Changed FlyteClusterResourceSync Deployment name

  • The names were hard coded
  • There existed a template already in the _helpers file
  • Labels did not match the resource names
  • This allows for consistency across the services
  • Note: Will delete and recreate the Deployment (not backwards compatible)

What changes were proposed in this pull request?

Helper methods refactored to allow nameOverride.
Service Accounts added and applied to Deployments.
values.yaml default values updated to array from map as that is what is expected

How was this patch tested?

Hand tested, I didn't see unit tests for the helm chart.

Setup process

Screenshots

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

mvaalexp added 2 commits May 14, 2024 15:28
Fixed flyte-core helm chart where ServiceAccounts were missing and some naming inconsistencies

Signed-off-by: mvaal <[email protected]>
Copy link

welcome bot commented May 14, 2024

Thank you for opening this pull request! 🙌

These tips will help get your PR across the finish line:

  • Most of the repos have a PR template; if not, fill it out to the best of your knowledge.
  • Sign off your commits (Reference: DCO Guide).

@@ -55,7 +55,7 @@ spec:
- mountPath: /var/run/credentials
name: cluster-secrets
{{- end }}
serviceAccountName: {{ .Values.cluster_resource_manager.service_account_name }}
serviceAccountName: {{ .Values.cluster_resource_manager.serviceAccount.create | ternary (include "flyteclusterresourcesync.name" .) .Values.cluster_resource_manager.service_account_name }}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attempted to keep backwards compatibility here.

@@ -2,7 +2,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: syncresources
name: {{ template "flyteclusterresourcesync.name" . }}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will technically recreate the deployment when it renames, not sure if that is an issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this re-create the deployment? or does this create a new deployment?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new, it will tear down the old deployment and make a new one. it renames this to flyteclusterresourcesync

https://github.com/flyteorg/flyte/blob/master/charts/flyte-core/templates/_helpers.tpl#L62

@@ -171,7 +171,7 @@ flytescheduler:
# -- Annotations for Flytescheduler pods
podAnnotations: {}
# -- Additional Flytescheduler container environment variables
podEnv: {}
podEnv: []
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are mapped to arrays, so it gives a warning when you set them in the values.yaml.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah thanks! 👍

That's my mistake and I probably missed this when I added it because we're setting podEnv values.

Copy link

codecov bot commented May 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.99%. Comparing base (653ca85) to head (9e3e27c).
Report is 12 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5362      +/-   ##
==========================================
+ Coverage   60.97%   60.99%   +0.02%     
==========================================
  Files         793      793              
  Lines       51331    51346      +15     
==========================================
+ Hits        31299    31319      +20     
+ Misses      17147    17141       -6     
- Partials     2885     2886       +1     
Flag Coverage Δ
unittests-datacatalog 69.31% <ø> (ø)
unittests-flyteadmin 58.70% <ø> (+0.03%) ⬆️
unittests-flytecopilot 17.79% <ø> (ø)
unittests-flytectl 67.97% <ø> (ø)
unittests-flyteidl 79.04% <ø> (ø)
unittests-flyteplugins 61.84% <ø> (+0.05%) ⬆️
unittests-flytepropeller 57.32% <ø> (-0.01%) ⬇️
unittests-flytestdlib 65.82% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wild-endeavor
Copy link
Contributor

sorry it's taken a long time to get to this @mvaalexp - would you mind taking one more look and regenerating the generated files to fix the conflicts please?

Only flyte console and the cluster resource controller are getting new service accounts correct? The others already have them? Also the cluster controller deployment will get recreated? Or will there be a duplicate one?

If you think it would be helpful to the community, could you also write a tiny blurb please that we can include on the release notes when this goes out? Just so there are no surprises for anyone using this helm chart. Would be most helpful.

@mvaalexp
Copy link
Author

mvaalexp commented Jun 13, 2024

No problem. I will take a look tomorrow and see what I am missing and write the blurb.

As I mentioned in the comment it will be new as a rename is basically a delete and create (as k8s can't rename a resource as far as I know). it renames this to flyteclusterresourcesync which is what was defined in the helpers file. If we can't afford to risk a rename here, we can probably work around it with a ternary or a new helper function, but it seems reasonable to keep it consistent if its not going to be a problem.

https://github.com/flyteorg/flyte/blob/master/charts/flyte-core/templates/_helpers.tpl#L62

Since clustersync is running flyteadmin, we want to give it the same permissions as flyteadmin SA (since that is the one we are replacing)

Signed-off-by: mvaal <[email protected]>
@mvaalexp
Copy link
Author

📝 Description

  • Made the resource naming more configurable in case there is governance in place in the cluster that requires certain naming conventions on resources
  • Added ServiceAccounts to Deployments that were missing them (this is in general best practice)
    • flyteclusterresourcesync, flyteconsole and flyte-core
  • Renamed a few files to follow the standards from other charts (mostly sa.yaml -> rbac.yaml)
  • Changed default helm values that were supposed to be arrays from objects to arrays (this was causing warnings in helm)

📝 User Notes

  • syncresources was renamed to flyteclusterresourcesync to follow the values found in the helper class rather than it being hard coded
    • This will delete and recreate the deployment
  • clusterresourcesync now uses its own ServiceAccount instead of sharing flyteadmin's
    • If users changed cluster_resource_manager, this may cause some backwards compatibility issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] flyte-core helm chart missing ServiceAccounts and chart has warning messages
3 participants